﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace devtm.Editor.Configuration.Merge
{

    public class DiffListe : ObservableCollection<DiffItem>
    {

        public bool ContainsAdded { get { return ContainsType(EnumDiff.SectionAdded); } }
        public bool ContainsUpdated { get { return ContainsType(EnumDiff.SectionUpdated); } }
        public bool ContainsDeleted { get { return ContainsType(EnumDiff.SectionDeleted); } }

        public bool ContainsOnlyAdded { get { return ContainsType(EnumDiff.SectionAdded); } }
        public bool ContainsOnlyUpdated { get { return ContainsType(EnumDiff.SectionUpdated); } }
        public bool ContainsOnlyDeleted { get { return ContainsType(EnumDiff.SectionDeleted); } }


        private bool ContainsType(EnumDiff type)
        {

            foreach (DiffItem item in this)
                if (item.Type == type)
                    return true;

            return false;
        }

        private bool ContainsOnlyType(EnumDiff type)
        {

            foreach (DiffItem item in this)
                if (item.Type != type)
                    return false;

            return true;
        }

    }

}
